import tkinter as tk
from random import randint


num = randint(1, 128)

window = tk.Tk()
window.title("Угадай число")
window.geometry('400x300')

frame = tk.Frame( window, padx = 10, pady = 10)
frame.pack(expand=True)

info_lb = tk.Label(frame, text="Введите число")
info_lb.grid(row=3, column=1)

tf = tk.Entry(frame)
tf.grid(row=3, column=2)

result_lb = tk.Label(frame, text="")
result_lb.grid(row=4, column=2)

def click_button():
    guess = tf.get()
    if guess.isdigit():
        guess = int(guess)
        if num < guess:
            result_lb["text"] = "Загаданное число меньше"
        elif num > guess:
            result_lb["text"] = "Загаданное число больше"
        else:
            result_lb["text"] = "Вы угадали!"
    else:
        result_lb["text"] = "Ошибка ввода"

btn = tk.Button(frame, text="Ok", command=click_button)
btn.grid(row=3, column=3)

window.mainloop()